home *** CD-ROM | disk | FTP | other *** search
- #include <hmatrix.h>
-
- HomogenousMatrixImplement(float);
-
- /* This is only done for HMat(float) right now because
- * of the global ::adjoint method (in C, yet).
- */
-
- #include "adjoint.h"
- /* Return the adjoint of a matrix, and the determinant
- * of the matrix in *det (if non-NULL).
- * Negate the adjoint if the determinant of the matrix
- * is < 0, to fix problems with perspective matrices.
- */
- HMat(float) adjoint(const HMat(float) &m, float *det) {
- HMat(float) adj;
- float v;
-
- v = ::adjoint(m, adj);
-
- if (v < 0) {
- for (int i = X; i <= W; i++)
- for (int j = X; j <= W; j++)
- adj[i][j] = -adj[i][j];
- }
-
- if (det)
- *det = v;
-
- return adj;
- }
-
-